/**
 * LEKU APPLIANCE CHAINS.
 * Copyright (c) 2016-2016 All Rights Reserved.
 */
package com.leku.mse.dao.impl.diary;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.leku.commons.datasource.DataSourceClient;
import com.leku.mse.dao.diary.DiaryDao;
import com.leku.mse.entity.diary.AlbumBaseEntity;
import com.leku.mse.entity.diary.DiaryBaseEntity;

/**
 * 功能描述: 手账服务
 *
 * @author suiying
 * @created 2018年1月2日
 * @version 1.0.0
 */
@Repository
public class DiaryDaoImpl implements DiaryDao {

    @Autowired
    private DataSourceClient dataSourceClient;

    /*
     * (non-Javadoc)
     * @see com.leku.mse.dao.diary.DiaryDao#getDiaryBase(java.lang.String)
     */
    @Override
    public DiaryBaseEntity getDiaryBase(String diaryId) {
        Map<String, Object> param = new HashMap<String, Object>();

        param.put("diaryId", diaryId);

        return dataSourceClient.selectOne("DiaryDao.getDiaryBase", param);
    }

    /*
     * (non-Javadoc)
     * @see com.leku.mse.dao.diary.DiaryDao#getDiaryData(java.lang.String)
     */
    @Override
    public String getDiaryData(String diaryId) {
        Map<String, Object> param = new HashMap<String, Object>();

        param.put("diaryId", diaryId);

        return dataSourceClient.selectOne("DiaryDao.getDiaryData", param);
    }

    /*
     * (non-Javadoc)
     * @see com.leku.mse.dao.diary.DiaryDao#updateDiaryScore(com.leku.mse.entity.diary.DiaryBaseEntity)
     */
    @Override
    public int updateDiaryScore(DiaryBaseEntity diaryBase) {

        return dataSourceClient.update("DiaryDao.updateDiaryScore", diaryBase);
    }

    /*
     * (non-Javadoc)
     * @see com.leku.mse.dao.diary.DiaryDao#insertDiaryHot(com.leku.mse.entity.diary.DiaryBaseEntity)
     */
    @Override
    public int insertDiaryHot(DiaryBaseEntity diaryBase) {

        return dataSourceClient.insert("DiaryDao.insertDiaryHot", diaryBase);
    }

    /*
     * (non-Javadoc)
     * @see com.leku.mse.dao.diary.DiaryDao#insertDiarySysRecom(com.leku.mse.entity.diary.DiaryBaseEntity)
     */
    @Override
    public int insertDiarySysRecom(DiaryBaseEntity diaryBase) {

        return dataSourceClient.insert("DiaryDao.insertDiarySysRecom", diaryBase);
    }

    /*
     * (non-Javadoc)
     * @see com.leku.mse.dao.diary.DiaryDao#deleteDiaryHot(java.lang.String)
     */
    @Override
    public int deleteDiaryHot(String diaryId) {
        Map<String, Object> param = new HashMap<String, Object>();

        param.put("diaryId", diaryId);

        return dataSourceClient.update("DiaryDao.deleteDiaryHot", param);
    }

    /*
     * (non-Javadoc)
     * @see com.leku.mse.dao.diary.DiaryDao#deleteDiarySysRecom(java.lang.String)
     */
    @Override
    public int deleteDiarySysRecom(String diaryId) {
        Map<String, Object> param = new HashMap<String, Object>();

        param.put("diaryId", diaryId);

        return dataSourceClient.update("DiaryDao.deleteDiarySysRecom", param);
    }

    /*
     * (non-Javadoc)
     * @see com.leku.mse.dao.diary.DiaryDao#getAlbumBase(java.lang.String)
     */
    @Override
    public AlbumBaseEntity getAlbumBase(String albumId) {
        Map<String, Object> param = new HashMap<String, Object>();

        param.put("albumId", albumId);

        return dataSourceClient.selectOne("DiaryDao.getAlbumBase", param);
    }

    /*
     * (non-Javadoc)
     * @see com.leku.mse.dao.diary.DiaryDao#queryDairyIds(java.lang.String)
     */
    @Override
    public List<String> queryDairyIds(String albumId) {
        Map<String, Object> param = new HashMap<String, Object>();

        param.put("albumId", albumId);

        return dataSourceClient.selectList("DiaryDao.queryDairyIds", param);
    }

    /*
     * (non-Javadoc)
     * @see com.leku.mse.dao.diary.DiaryDao#updateDiaryEditStatus(java.lang.String)
     */
    @Override
    public int updateDiaryEditStatus(String diaryId) {
        Map<String, Object> param = new HashMap<String, Object>();

        param.put("diaryId", diaryId);

        return dataSourceClient.update("DiaryDao.updateDiaryEditStatus", param);
    }

    /*
     * (non-Javadoc)
     * @see com.leku.mse.dao.diary.DiaryDao#updateDiaryDelStatus(java.lang.String)
     */
    @Override
    public int updateDiaryDelStatus(String diaryId) {
        Map<String, Object> param = new HashMap<String, Object>();

        param.put("diaryId", diaryId);

        return dataSourceClient.update("DiaryDao.updateDiaryDelStatus", param);
    }

    /*
     * (non-Javadoc)
     * @see com.leku.mse.dao.diary.DiaryDao#updateDiaryMoveStatus(java.lang.String)
     */
    @Override
    public int updateDiaryMoveStatus(String diaryId) {
        Map<String, Object> param = new HashMap<String, Object>();

        param.put("diaryId", diaryId);

        return dataSourceClient.update("DiaryDao.updateDiaryMoveStatus", param);
    }

    /*
     * (non-Javadoc)
     * @see com.leku.mse.dao.diary.DiaryDao#deleteDiaryTaste(java.lang.String)
     */
    @Override
    public int deleteDiaryTaste(String diaryId) {
        Map<String, Object> param = new HashMap<String, Object>();

        param.put("diaryId", diaryId);

        return dataSourceClient.update("DiaryDao.deleteDiaryTaste", param);
    }

    /*
     * (non-Javadoc)
     * @see com.leku.mse.dao.diary.DiaryDao#updateDiarySearch(com.leku.mse.entity.diary.DiaryBaseEntity)
     */
    @Override
    public int updateDiarySearch(DiaryBaseEntity diaryBase) {

        return dataSourceClient.update("DiaryDao.updateDiarySearch", diaryBase);
    }

    /*
     * (non-Javadoc)
     * @see com.leku.mse.dao.diary.DiaryDao#insertDiarySearch(com.leku.mse.entity.diary.DiaryBaseEntity)
     */
    @Override
    public int insertDiarySearch(DiaryBaseEntity diaryBase) {

        return dataSourceClient.insert("DiaryDao.insertDiarySearch", diaryBase);
    }

    /*
     * (non-Javadoc)
     * @see com.leku.mse.dao.diary.DiaryDao#deleteDiarySearch(java.lang.String)
     */
    @Override
    public int deleteDiarySearch(String diaryId) {
        Map<String, Object> param = new HashMap<String, Object>();

        param.put("diaryId", diaryId);

        return dataSourceClient.update("DiaryDao.deleteDiarySearch", param);
    }

    /*
     * (non-Javadoc)
     * @see com.leku.mse.dao.diary.DiaryDao#updateMemDiary(com.leku.mse.entity.diary.DiaryBaseEntity)
     */
    @Override
    public int updateMemDiary(DiaryBaseEntity diaryBase) {

        return dataSourceClient.update("DiaryDao.updateMemDiary", diaryBase);
    }

    /*
     * (non-Javadoc)
     * @see com.leku.mse.dao.diary.DiaryDao#insertMemDiary(com.leku.mse.entity.diary.DiaryBaseEntity)
     */
    @Override
    public int insertMemDiary(DiaryBaseEntity diaryBase) {

        return dataSourceClient.insert("DiaryDao.insertMemDiary", diaryBase);
    }

    /*
     * (non-Javadoc)
     * @see com.leku.mse.dao.diary.DiaryDao#deleteMemDiary(java.lang.String)
     */
    @Override
    public int deleteMemDiary(String diaryId) {
        Map<String, Object> param = new HashMap<String, Object>();

        param.put("diaryId", diaryId);

        return dataSourceClient.update("DiaryDao.deleteMemDiary", param);
    }

    /*
     * (non-Javadoc)
     * @see com.leku.mse.dao.diary.DiaryDao#getDiaryImg(java.lang.String)
     */
    @Override
    public DiaryBaseEntity getDiaryImg(String diaryId) {
        Map<String, Object> param = new HashMap<String, Object>();

        param.put("diaryId", diaryId);

        return dataSourceClient.selectOne("DiaryDao.getDiaryImg", param);
    }

    /*
     * (non-Javadoc)
     * @see com.leku.mse.dao.diary.DiaryDao#updateDiaryTasteStatus(java.lang.String, java.lang.Integer)
     */
    @Override
    public int updateDiaryTasteStatus(String diaryId, Integer status) {
        Map<String, Object> param = new HashMap<String, Object>();

        param.put("diaryId", diaryId);
        param.put("status", status);

        return dataSourceClient.update("DiaryDao.updateDiaryTasteStatus", param);
    }

}
